//datamap.hpp
//
//

#ifndef DATAMAP_HPP
#define DATAMAP_HPP

#include <cstdlib>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <iostream>

#include "keyring.hpp"

using namespace std;

class DataMap  {
public:

  // Initializes the object
  DataMap(const char& delimiter, const string& missingID);

  // Destructs the object
  ~DataMap();

  // Merges new data into the object
  void merge(string fileName);

  void printToStream(ostream& toStream);

#ifndef TEST__
private:
#endif

  // Extracts an element from the data map
  string at(const size_t i,const size_t j);

  // Merges data into the object from the stream 
  void mergeDelimitedDataFromStream(ifstream& dataStream);

  // Removes trailing end-of-line characters
  string chomp(const string& str);

  // Transforms a string to uppercase
  string toUpperCase(const string& str);

  // Information about the file type for proper parsing
  //FileType fileType_;
  char delimiter_;
  string missingID_;

  // Row headers
  //vector<string> rowHeaders_;
  
  KeyRing rowKeys_;
  KeyRing colKeys_;

  // Column headers
  //set<string>    colHeaderSet_;
  //vector<string> colHeaders_;

  // The data container as an associative map: data[rowName][colName] = value
  map<size_t,map<size_t,string> > data_;
  
};

#endif
